#include "head.h"
#include <iostream>

using std::cout;
using std::endl;

int main()
{
    unsigned short port = 8888;
    //将小端模式转换为大端模式
    unsigned short nport = htons(port);
    printf("port: %p\n", port);
    printf("nport: %p\n", nport);

    //将大端模式转换为小端模式
    unsigned short port2 = ntohs(nport);
    printf("port2: %p\n", port2);
    printf("port2: %d\n", port2);

    return 0;
}

